3.279 \(\int \frac {x^2+x^3}{-2+x+x^2} \, dx\)

Optimal. Leaf size=26 \[ \frac {x^2}{2}+\frac {2}{3} \log (1-x)+\frac {4}{3} \log (x+2) \]

[Out]

1/2*x^2+2/3*ln(1-x)+4/3*ln(2+x)

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 26, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {1593, 800, 632, 31} \[ \frac {x^2}{2}+\frac {2}{3} \log (1-x)+\frac {4}{3} \log (x+2) \]

Antiderivative was successfully verified.

[In]

Int[(x^2 + x^3)/(-2 + x + x^2),x]

[Out]

x^2/2 + (2*Log[1 - x])/3 + (4*Log[2 + x])/3

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 632

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[
(c*d - e*(b/2 - q/2))/q, Int[1/(b/2 - q/2 + c*x), x], x] - Dist[(c*d - e*(b/2 + q/2))/q, Int[1/(b/2 + q/2 + c*
x), x], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] && NiceSqrtQ[b^2 - 4*a*
c]

Rule 800

Int[(((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_)))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Int[Exp
andIntegrand[((d + e*x)^m*(f + g*x))/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] && NeQ[b^2 -
 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && IntegerQ[m]

Rule 1593

Int[(u_.)*((a_.)*(x_)^(p_.) + (b_.)*(x_)^(q_.))^(n_.), x_Symbol] :> Int[u*x^(n*p)*(a + b*x^(q - p))^n, x] /; F
reeQ[{a, b, p, q}, x] && IntegerQ[n] && PosQ[q - p]

Rubi steps

\begin {align*} \int \frac {x^2+x^3}{-2+x+x^2} \, dx &=\int \frac {x^2 (1+x)}{-2+x+x^2} \, dx\\ &=\int \left (x+\frac {2 x}{-2+x+x^2}\right ) \, dx\\ &=\frac {x^2}{2}+2 \int \frac {x}{-2+x+x^2} \, dx\\ &=\frac {x^2}{2}+\frac {2}{3} \int \frac {1}{-1+x} \, dx+\frac {4}{3} \int \frac {1}{2+x} \, dx\\ &=\frac {x^2}{2}+\frac {2}{3} \log (1-x)+\frac {4}{3} \log (2+x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.00, size = 26, normalized size = 1.00 \[ \frac {x^2}{2}+\frac {2}{3} \log (1-x)+\frac {4}{3} \log (x+2) \]

Antiderivative was successfully verified.

[In]

Integrate[(x^2 + x^3)/(-2 + x + x^2),x]

[Out]

x^2/2 + (2*Log[1 - x])/3 + (4*Log[2 + x])/3

________________________________________________________________________________________

fricas [A]  time = 0.54, size = 18, normalized size = 0.69 \[ \frac {1}{2} \, x^{2} + \frac {4}{3} \, \log \left (x + 2\right ) + \frac {2}{3} \, \log \left (x - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^3+x^2)/(x^2+x-2),x, algorithm="fricas")

[Out]

1/2*x^2 + 4/3*log(x + 2) + 2/3*log(x - 1)

________________________________________________________________________________________

giac [A]  time = 0.16, size = 20, normalized size = 0.77 \[ \frac {1}{2} \, x^{2} + \frac {4}{3} \, \log \left ({\left | x + 2 \right |}\right ) + \frac {2}{3} \, \log \left ({\left | x - 1 \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^3+x^2)/(x^2+x-2),x, algorithm="giac")

[Out]

1/2*x^2 + 4/3*log(abs(x + 2)) + 2/3*log(abs(x - 1))

________________________________________________________________________________________

maple [A]  time = 0.00, size = 19, normalized size = 0.73 \[ \frac {x^{2}}{2}+\frac {4 \ln \left (x +2\right )}{3}+\frac {2 \ln \left (x -1\right )}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^3+x^2)/(x^2+x-2),x)

[Out]

1/2*x^2+4/3*ln(x+2)+2/3*ln(x-1)

________________________________________________________________________________________

maxima [A]  time = 0.43, size = 18, normalized size = 0.69 \[ \frac {1}{2} \, x^{2} + \frac {4}{3} \, \log \left (x + 2\right ) + \frac {2}{3} \, \log \left (x - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^3+x^2)/(x^2+x-2),x, algorithm="maxima")

[Out]

1/2*x^2 + 4/3*log(x + 2) + 2/3*log(x - 1)

________________________________________________________________________________________

mupad [B]  time = 0.05, size = 18, normalized size = 0.69 \[ \frac {2\,\ln \left (x-1\right )}{3}+\frac {4\,\ln \left (x+2\right )}{3}+\frac {x^2}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^2 + x^3)/(x + x^2 - 2),x)

[Out]

(2*log(x - 1))/3 + (4*log(x + 2))/3 + x^2/2

________________________________________________________________________________________

sympy [A]  time = 0.24, size = 20, normalized size = 0.77 \[ \frac {x^{2}}{2} + \frac {2 \log {\left (x - 1 \right )}}{3} + \frac {4 \log {\left (x + 2 \right )}}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x**3+x**2)/(x**2+x-2),x)

[Out]

x**2/2 + 2*log(x - 1)/3 + 4*log(x + 2)/3

________________________________________________________________________________________